﻿// Decompiled with JetBrains decompiler
// Type: Netick.CodeGen.Exts
// Assembly: Netick.CodeGen, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 95965C71-875F-44B8-BA79-93A19C7D6A17
// Assembly location: D:\WorkSpaceDemo\UPM\NetickForUnity\Netick\Editor\Netick.CodeGen.dll

using Mono.Cecil.Cil;
using System;
using System.Collections.Generic;
using System.IO;

#nullable disable
namespace Netick.CodeGen;

internal static class Exts
{
  public static void AddError(this List<DiagnosticMessage> diagnostics, string message)
  {
    diagnostics.AddError((SequencePoint) null, message);
  }

  public static void AddError(
    this List<DiagnosticMessage> diagnostics,
    SequencePoint sequencePoint,
    string message)
  {
    diagnostics.Add(new DiagnosticMessage()
    {
      File = sequencePoint?.Document.Url.Replace($"{Environment.CurrentDirectory}{Path.DirectorySeparatorChar}", ""),
      Line = sequencePoint != null ? sequencePoint.StartLine : 0,
      Column = sequencePoint != null ? sequencePoint.StartColumn : 0,
      MessageData = " - " + message
    });
  }
}
